import os

cwdlist = os.listdir( "." )
for i in cwdlist:
    a = os.path.splitext(i)[-1]
    if a == '.html' or a == '.txt':
        f = open( i , "rb" )
        b = f.read().decode("gb2312").encode("utf-8")
        f = open( i , "wb" )
        f.write( b )
        f.close()

